package com.tensquare.article.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.tensquare.article.model.Article;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;


public interface ArticleDao extends JpaRepository<Article,String>,JpaSpecificationExecutor<Article>{

    @Modifying
    @Query(nativeQuery = true, value ="UPDATE tb_article SET state = 1 WHERE id = ?")
    void examine(String articleId) ;

    @Modifying
    @Query(nativeQuery = true, value ="UPDATE tb_article SET thumbup = thumbup+1 WHERE id = ?1")
    void addThumbup(String articleId) ;
	
}
